package cn.edu.zsc.blms.domain;

import cn.edu.zsc.blms.util.DateUtil;

import java.util.Date;

public class Borrowing extends BaseEntity {

    /**
     * 读者
     */
    public Reader reader;

    /**
     * 图书
     */
    public Book book;

    /**
     * 借书时间
     */
    public Date borrowTime;
    public Date returnTime;


    public Borrowing(){
    }

    public Borrowing(Integer id,Reader reader,Book book,Date borrowTime){
        super(id);
        this.reader = reader;
        this.book = book;
        this.borrowTime = borrowTime;
    }

    @Override
    public String toString(){

        return "ID:"+ id +",读者姓名:" + reader.name +",图书名称:"+ book.name
                +",借出时间:" + DateUtil.formatTime(borrowTime)
                +",归还时间:" + (returnTime == null ? "" : DateUtil.formatTime(returnTime));

    }
}
